From 334a127df426286101f90c4f9ec79f8b64d59f14 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 25 Nov 2021 06:01:51 +0200 Subject: [PATCH] fw4.uc: introduce DEPRECATED flag When a section contains unknown options, the parse_options function will return false, and based on that the entire section might be skipped. For example, rules containing a _name option will be skipped. As this option used to be added by LuCI in the past, we should not skip those rules, as it might break existing configs for many users. Add a new DEPRECATED flag to handle such options. Suggested-by: Jo-Philipp Wich Signed-off-by: Stijn Tintel Reviewed-by: Jo-Philipp Wich --- root/usr/share/ucode/fw4.uc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index 8057fac..df5ab87 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -11,6 +11,7 @@ let FLATTEN_LIST = 0x02; let NO_INVERT = 0x04; let UNSUPPORTED = 0x08; let REQUIRED = 0x10; +let DEPRECATED = 0x20; let ipv4_icmptypes = { "any": [ 0xFF, 0, 0xFF ], @@ -622,7 +623,9 @@ return { } if (res != null) { - if (flags & UNSUPPORTED) + if (flags & DEPRECATED) + this.warn_section(s, "option '" + key + "' is deprecated by fw4"); + else if (flags & UNSUPPORTED) this.warn_section(s, "option '" + key + "' is not supported by fw4"); else rv[key] = res; -- 2.30.2